package com.itheima.common.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    //状态码
    private int code;
    //信息
    private String msg;
    //数据
    private Object data;


   public static Result success(){
       return new Result();
   }
    public static Result success(String msg,Object data){
        return new Result(1,msg,data);
    }
    //成功
    public static Result success(Object data){
        return new Result(1,"成功",data);
    }
    //失败
    public static Result error(Object data){
        return new Result(0,"失败",data);
    }
    //成功
    public static Result success(String msg){
        return new Result(1,msg,null);
    }
    //失败
    public static Result error(String msg){
        return new Result(0,msg,null);
    }
}
